package controllers.commands.elecboundary
{
	import controllers.commands.base.ICommand;
	import controllers.managers.SingletonManager;
	
	import flash.events.Event;
	
	import model.context.StartEleBoundaryProtocalContext;
	import model.vo.ProtocalEleBoundary;
	
	import mx.logging.ILogger;
	
	import net.NetLoader;
	
	import utils.LogUtil;
	
	/**
	 *  发送协议命令
	 **/
	public class SubmitEleBoundaryProtocalCommand implements ICommand
	{		
		public static var NAME : String = "SendProtocalCommand.as";
		private var logger:ILogger =  LogUtil.getInst().getLogger( NAME );
		
		private var gContext : StartEleBoundaryProtocalContext = null;
		
		public function SubmitEleBoundaryProtocalCommand()
		{
		}
		
		public function setContext(context:Object):void
		{
			gContext = StartEleBoundaryProtocalContext(context);
		}
		
		public function execute():void
		{
			var netLoader : NetLoader = new NetLoader();
			var protocal : ProtocalEleBoundary 
								= ProtocalEleBoundary(SingletonManager.getServ(ProtocalEleBoundary.NAME));
			var url : String = protocal.createByContext( gContext ) ;
			url = Global.SERVER_DEVICE_URL.concat("?").concat(url);
			netLoader.load( url, onCallBackHandler); 
		}
		
		private function onCallBackHandler(e:Object):void
		{
			logger.info("消息返回:" + e.target);
		}
	}
}